


        var headSwiper = new Swiper('.headSwiper',{
            allowTouchMove:false,
            pagination:{
                el:'.headPg',
                clickable:true
            },
            autoplay:{
                disableOnInteraction: false,
            },
        })


        var newsSwiper = new Swiper('.newsSwiper',{
            slidesPerView:3,
            slidesPerGroup:1,
            allowTouchMove:true,
            speed:800,
            autoplay:{
                disableOnInteraction: false,
            },
        })

        var feedbkSwiper = new Swiper('.feedbkSwiper',{
            allowTouchMove:false,
            loop:true,
            speed:600
        })

        var memberSwiper = new Swiper('.memberSwiper',{
            allowTouchMove:false,
            slidesPerView:4,
            slidesPerGroup:1,
            loop: true,
            speed:800,
            delay:500,
            autoplay:{
                disableOnInteraction: false,
            }
        })

        var watchNews = null;
        var offerPicsH = null;
        var reactH = null
        var startRoll = null;
        var rollNums = null;

        $(document).ready(function(){
            $('main .offer .offerList .pics .item:first-child').addClass('show');
            $('main .offer .offerList ul li').mouseenter(function(){
                $('main .offer .offerList .pics .item').removeClass('show');
                var ind = $(this).index();
                $('main .offer .offerList .pics .item:eq(' + ind + ')').addClass('show');
            })
            $('main .offer .offerList .pics .item .type').click(function(){
                $('main .offer .offerList .pics .item .box').removeClass('react');
                var clickself = $(this).parent()[0].className.indexOf('show') >= 0?true:false;
                var This = this;
                setTimeout(function(){
                    $('main .offer .offerList .pics .item .box').height(0);
                    $('main .offer .offerList .pics .item').removeClass('show');
                    if(!clickself){
                        $(This).parent().addClass('show');
                    }
                },10)
                
            })

            offerPicH = setInterval(function(){
                if(window.innerWidth >= 768) return false;
                if($('main .offer .offerList .pics .item.show').length){
                    var boxH = parseInt($('main .offer .offerList .pics .item.show .box')[0].style.height);
                    var innH = $('main .offer .offerList .pics .item.show .box .inner')[0].offsetHeight;
                    if(boxH != innH){
                        clearTimeout(reactH);
                        $('main .offer .offerList .pics .item.show .box').height(innH);
                        reactH = setTimeout(function(){
                            $('main .offer .offerList .pics .item.show .box').addClass('react');
                        },510)
                    }
                }
            },10)
            var length = $('main .news .fluid .newsSwiper .swiper-slide').length;
            for(var n = 0;n < $('main .news .fluid .newsSwiper .swiper-slide').length;n++){
                $('main .news .fluid .newsSwiper .swiper-slide')[n].ind = n;
            }
            //$('main .news .fluid .newsSwiper .newsPg span').addClass('hidden');
            
            for(var p = 0;p < Math.ceil(length / newsSwiper.params.slidesPerView);p++){
                var  elP = document.createElement('p');
                $('main .news .fluid .page').append(elP);
            }
            watchNews = setInterval(function(){
                var present = $('main .news .fluid .newsSwiper .swiper-slide-active')[0].ind + 1;
                var perView = newsSwiper.params.slidesPerView;
                var length = $('main .news .fluid .newsSwiper .swiper-slide').length;
                if(present + perView - 1 == length){
                    $('main .news .fluid .page p').removeClass('active'); 
                    $('main .news .fluid .page p:last-child').addClass('active');
                    return false;
                }
                var ind = Math.ceil(present / perView);
                if($('main .news .fluid .page p:eq(' + (ind - 1) + ')')[0].className.indexOf('active') < 0){
                    $('main .news .fluid .page p').removeClass('active'); 
                    $('main .news .fluid .page p:eq(' + (ind - 1) + ')').addClass('active');
                }
            },10)

            $('main .news .fluid .page p').click(function(){
                var ind = $(this).index();
                var perView = newsSwiper.params.slidesPerView;
                newsSwiper.slideTo(ind * perView);
            })

            $('main .feedback .fluid>p').click(function(){
                if($(this)[0].className.indexOf('prev') >= 0){
                    feedbkSwiper.slidePrev();
                }else{
                    feedbkSwiper.slideNext();
                }
            })
            $('main .team .fluid>p').click(function(){
                if($(this)[0].className.indexOf('prev') >= 0){
                    memberSwiper.slidePrev();
                }else{
                    memberSwiper.slideNext();
                }
            })

            watchBrowse = setInterval(function(){
                if(window.innerWidth >= 1200 && newsSwiper.params.slidesPerView != 3){
                    newsSwiper.params.slidesPerView = 3;
                    newsSwiper.update();
                    $('main .news .fluid .page').empty();
                    for(var p = 0;p < Math.ceil(length / newsSwiper.params.slidesPerView);p++){
                        var  elP = document.createElement('p');
                        $('main .news .fluid .page').append(elP);
                    }
                    $('main .news .fluid .page p').click(function(){
                        var ind = $(this).index();
                        var perView = newsSwiper.params.slidesPerView;
                        newsSwiper.slideTo(ind * perView);
                    })
                }else if(window.innerWidth >= 768 && window.innerWidth < 1200 && newsSwiper.params.slidesPerView != 2){
                    newsSwiper.params.slidesPerView = 2;
                    newsSwiper.update();
                    $('main .news .fluid .page').empty();
                    for(var p = 0;p < Math.ceil(length / newsSwiper.params.slidesPerView);p++){
                        var  elP = document.createElement('p');
                        $('main .news .fluid .page').append(elP);
                    }
                    $('main .news .fluid .page p').click(function(){
                        var ind = $(this).index();
                        var perView = newsSwiper.params.slidesPerView;
                        newsSwiper.slideTo(ind * perView);
                    })
                }else if(window.innerWidth < 768 && newsSwiper.params.slidesPerView != 1){
                    newsSwiper.params.slidesPerView = 1;
                    newsSwiper.update();
                    $('main .news .fluid .page').empty();
                    for(var p = 0;p < Math.ceil(length / newsSwiper.params.slidesPerView);p++){
                        var  elP = document.createElement('p');
                        $('main .news .fluid .page').append(elP);
                    }
                    $('main .news .fluid .page p').click(function(){
                        var ind = $(this).index();
                        var perView = newsSwiper.params.slidesPerView;
                        newsSwiper.slideTo(ind * perView);
                    })
                }


                if(window.innerWidth >= 768 && memberSwiper.params.slidesPerView != 4){
                    memberSwiper.params.slidesPerView = 4;
                    memberSwiper.update();
                }else if(window.innerWidth > 635 && window.innerWidth < 768 && memberSwiper.params.slidesPerView != 3){
                    memberSwiper.params.slidesPerView = 3;
                    memberSwiper.update();
                }else if(window.innerWidth > 465 && window.innerWidth <= 635 && memberSwiper.params.slidesPerView != 2){
                    memberSwiper.params.slidesPerView = 2;
                    memberSwiper.update();
                }else if(window.innerWidth <= 465 && memberSwiper.params.slidesPerView != 1){
                    memberSwiper.params.slidesPerView = 1;
                    memberSwiper.update();
                }
                
            },10)

            startRoll = setInterval(function(){
                if($('.data .frozen').length){
                    clearInterval(startRoll);
                    for(var n = 0;n < $('main .data .item .num').length;n++){
                        makeInterval($('main .data .item .num')[n]);
                    }
                }
            },10)
            var time = 2000;    
            for(var nm = 0;nm < $('main .data .item .num').length;nm++){
                var val = Number($('main .data .item .num')[nm].innerText);
                $('main .data .item .num')[nm].val = val;
                $('main .data .item .num')[nm].average = time / val;
                $('main .data .item .num')[nm].innerText = '0';
                $('main .data .item .num')[nm].cal = 0;
            }
            function makeInterval(ele){
                var avrg = ele.average;
                if(avrg < 10){
                    ele.timeOut = function(){
                        setTimeout(function(){
                            if(ele.cal < time / 10){
                                var cal = ele.cal;
                                cal += 1;
                                ele.cal = cal;
                                var inner = Number(ele.innerText);
                                ele.innerText = String(inner + Math.floor(10 / avrg));
                                ele.timeOut();
                            }else{
                                ele.innerText = ele.val;
                            }
                        },10)
                    }
                }else{
                    avrg = Math.floor(ele.average);
                    ele.timeOut = function(){
                        setTimeout(function(){
                            if(ele.cal < time){
                                var cal = ele.cal;
                                cal += avrg;
                                ele.cal = cal;
                                var inner = Number(ele.innerText);
                                ele.innerText = (inner + 1);
                                ele.timeOut()
                            }else{
                                ele.innerText = ele.val;
                            }
                        },avrg)
                    }
                }
                ele.timeOut();
            }
            
        })